<!-- 客户开通虚拟仓页面页面 -->
<template>
  <div class="supplierMessage">
    <!-- 查询客户卡片 -->
    <el-card class="searchCard" shadow="never" :body-style="{ padding: '20px' }">
      <div slot="header">
        <span>开通虚拟仓</span>
      </div>
      <!-- 查询客户列表 -->
      <el-form ref="searchForm" class="searchForm" :model="searchForm" label-width="100px" :inline="false" size="normal">
        <!-- 客户类型选择 -->
        <el-form-item label="客户类型:">
          <el-select v-model="searchForm.type" size="small" placeholder="客户类型">
            <el-option label="销售渠道" value="1" />
            <el-option label="大客户" value="2" />
            <el-option label="散户" value="3" />
            <el-option label="全部" value="4" />
          </el-select>
        </el-form-item>
        <!-- 客户属性选择 -->
        <el-form-item label="客户属性:">
          <el-select v-model="searchForm.attribute" size="small" placeholder="客户属性">
            <el-option label="个人" value="1" />
            <el-option label="企业" value="2" />
            <el-option label="全部" value="3" />
          </el-select>
        </el-form-item>
        <!-- 输入联系人手机号 -->
        <el-form-item label="联系人手机:">
          <el-input v-model="searchForm.connectPhone" style="width:200px" placeholder="联系人手机" size="small" clearable />
        </el-form-item>
        <!-- 输入联系人姓名 -->
        <el-form-item label="联系人姓名:">
          <el-input v-model="searchForm.connectName" style="width:200px" placeholder="联系人" size="small" clearable />
        </el-form-item>
        <!-- 输入公司名称 -->
        <el-form-item label="公司名称:">
          <el-input v-model="searchForm.conpanyName" style="width:200px" placeholder="公司名称" size="small" clearable />
        </el-form-item>
        <!-- 输入客户编号 -->
        <el-form-item label="客户编号:">
          <el-input v-model="searchForm.conpanyName" style="width:200px" placeholder="客户编号" size="small" clearable />
        </el-form-item>
        <!-- 查询取消按钮 -->
        <el-form-item>
          <el-button type="primary" size="small">查询</el-button>
          <el-button type="default" size="small">取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <!-- 客户列表卡片 -->
    <el-card class="supplierList" shadow="never" :body-style="{ padding: '20px' }">
      <div slot="header">
        <span>客户列表</span>
        <el-button type="primary" style="width:80px;margin-left:20px" size="small" @click="addCustomer">新增客户</el-button>
      </div>
      <template>
        <!-- 客户列表 -->
        <el-table
          :data="tableData"
          style="width: 100%"
          border
          :header-cell-style="{textAlign: 'center'}"
          :cell-style="{ textAlign: 'center' }"
        >
          <el-table-column
            prop="num"
            label="序号"
            width="200"
          />
          <el-table-column
            prop="customerNum"
            label="客户编号"
            width="200"
          />
          <el-table-column
            prop="customerType"
            label="客户类型"
            width="200"
          />
          <el-table-column
            prop="attribute"
            label="客户属性"
          />
          <el-table-column
            prop="connectName"
            label="联系人姓名"
          />
          <el-table-column
            prop="connectPhone"
            label="联系人手机"
          />
          <el-table-column
            prop="companyName"
            label="公司名称"
          />
          <el-table-column
            label="操作"
            width="200"
          >
            <template slot-scope="scope">
              <el-button type="text" size="small" @click="checkSupplier(scope.row)">查看</el-button>
              <el-button type="text" size="small" @click="dialogFormVisible = true">确定</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 查看客户信息 -->
        <el-dialog
          title="用户信息"
          :visible.sync="dialogVisible"
          width="20%"
          style="margin-top:120px;"
          class="dialog"
        >
          <div class="customerMessage">
            <!-- 弹框显示信息 -->
            <div>客户属性：{{ costomerMessage.attribute }}</div>
            <div>客户类型：{{ costomerMessage.customerType }}</div>
            <div>联系人姓名：{{ costomerMessage.connectName }}</div>
            <div>联系人手机：{{ costomerMessage.connectPhone }}</div>
            <div>公司名称：{{ costomerMessage.companyName }}</div>
            <div>公司地址：{{ costomerMessage.companyAddress }}</div>
            <div>营业执照：{{ costomerMessage.businessLicense }}</div>
            <div>身份证号：{{ costomerMessage.identityNum }}</div>
            <div>职业：{{ costomerMessage.profession }}</div>
            <div>备注：{{ costomerMessage.remark }}</div>
            <div>余额：{{ costomerMessage.balance }}</div>
          </div>
        </el-dialog>
        <div class="block">
          <!-- 客户列表分页器 -->
          <el-pagination
            :current-page="currentPage4"
            :page-sizes="[100, 200, 300, 400]"
            :page-size="100"
            layout="total, sizes, prev, pager, next, jumper"
            :total="400"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </div>
        <!-- 确定弹框内容 -->
        <el-dialog title="开通虚拟仓" class="open" :visible.sync="dialogFormVisible">
          <el-form :model="form">
            <el-form-item label="登录账号:" :label-width="formLabelWidth">
              <p>{{ costomerMessage.connectPhone }}</p>
            </el-form-item>
            <el-form-item label="设置密码:" :label-width="formLabelWidth">
              <el-input v-model="form.name" size="small" style="width:300px" autocomplete="off" />
            </el-form-item>
            <el-form-item label="确认密码:" :label-width="formLabelWidth">
              <el-input v-model="form.name" size="small" style="width:300px" autocomplete="off" />
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" style="width:100px" @click="dialogFormVisible = false">提 交</el-button>
            <el-button style="width:100px" @click="dialogFormVisible = false">取 消</el-button>
          </div>
        </el-dialog>
      </template>
    </el-card>
  </div>
</template>

<script>
export default {
// import引入的组件需要注入到对象中才能使用，
  components: {},
  data() {
    // 这里存放数据
    return {
      // 开通虚拟仓弹框数据
      dialogFormVisible: false,
      form: {
        name: ''
      },
      formLabelWidth: '120px',
      costomerMessage: {}, // 客户信息
      dialogVisible: false, // 控制查看表单显示
      searchForm: {
        companyName: '', // 供应商名字
        type: '4', // 客户类型
        attribute: '3', // 客户属性
        connectName: '', // 联系人姓名
        connectPhone: '' // 联系电话
      },
      tableData: [{
        num: '01',
        customerNum: 'KH2110080001',
        customerType: '销售渠道',
        attribute: '企业',
        connectName: '张三',
        companyName: '微红健康',
        connectPhone: '17311111111'
      }, {
        num: '02',
        customerNum: 'KH2110080001',
        customerType: '销售渠道',
        attribute: '企业',
        connectName: '张三',
        companyName: '微红健康',
        connectPhone: '17311111111'
      }, {
        num: '03',
        customerNum: 'KH2110080001',
        customerType: '销售渠道',
        attribute: '企业',
        connectName: '张三',
        companyName: '微红健康',
        connectPhone: '17311111111'
      }],
      currentPage4: 2 // 当前页数

    }
  },
  // 监听属性 类似于data概念
  computed: {},
  // 监控data中的数据变化
  watch: {},
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {

  },
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {

  },
  beforeCreate() {}, // 生命周期 - 创建之前
  beforeMount() {}, // 生命周期 - 挂载之前
  beforeUpdate() {}, // 生命周期 - 更新之前
  updated() {}, // 生命周期 - 更新之后
  beforeDestroy() {}, // 生命周期 - 销毁之前
  destroyed() {}, // 生命周期 - 销毁完成
  activated() {},
  // 方法集合
  methods: {
    determine() { // 点击确定按钮出现弹框

    },
    editSupplier() {
      this.$router.push({ // 跳转到编辑供应商页面
        name: 'EditCustomer'
      })
    },
    checkSupplier(el) { // 查看客户信息事件
      this.dialogVisible = true
      this.costomerMessage = el
      console.log(el)
    },
    addCustomer() { // 跳转到添加客户页面
      this.$router.push({
        name: 'AddCustomer'
      })
    },
    handleSizeChange(val) { // 分页器事件每页条数
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange(val) { // 分页器事件当前页
      console.log(`当前页: ${val}`)
    }
  } // 如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style scoped lang="scss">
.supplierMessage{
   width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #f0f2f5;
    .searchCard{
      margin: 30px;
      .searchForm{//搜索表单样式
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
      }
    }
    .supplierList{//供应商列表
      margin: 30px;
    }
    .open{//开通虚拟仓弹框
     display:flex;
     justify-content: space-around;
     align-items: center;
     margin-left: 500px;
     margin-top: -300px;
     width:60%;
    }
    .dialog-footer{//开通虚拟仓按钮
    margin-top: -20px;
      display: flex;
      justify-content: space-around;
    }
    .block{//分页器样式
      margin-top: 20px;
        padding: 20px;
        display: flex;
        justify-content: center;
      }

      .customerMessage{//客户信息样式
          padding: 0px 10px;
        div{
          margin-bottom: 20px;
        }
    }

}
</style>
